package com.caipos.ruleNode.mqtt;

import com.caipos.actor.api.NodeConfiguration;
import com.caipos.ruleEngine.credentials.AnonymousCredentials;
import com.caipos.ruleEngine.credentials.ClientCredentials;
import lombok.Data;

@Data
public class KbMqttNodeConfiguration implements NodeConfiguration<KbMqttNodeConfiguration> {

    private String topicPattern;
    private String host;
    private int port;
    private int connectTimeoutSec;
    private String clientId;
    private boolean appendClientIdSuffix;
    private boolean retainedMessage;

    private boolean cleanSession;
    private boolean ssl;
    private boolean parseToPlainText;
    private ClientCredentials credentials;

    @Override
    public KbMqttNodeConfiguration defaultConfiguration() {
        KbMqttNodeConfiguration configuration = new KbMqttNodeConfiguration();
        configuration.setTopicPattern("my-topic");
        configuration.setPort(1883);
        configuration.setConnectTimeoutSec(10);
        configuration.setCleanSession(true);
        configuration.setSsl(false);
        configuration.setRetainedMessage(false);
        configuration.setParseToPlainText(false);
        configuration.setCredentials(new AnonymousCredentials());
        return configuration;
    }

}
